package thesis.database;

import java.sql.ResultSet;
import java.sql.SQLException;

import org.springframework.jdbc.core.RowMapper;

public class CustomerMapper implements RowMapper<Customer> {

	@Override
	public Customer mapRow(ResultSet rs, int rowNum) throws SQLException {
		Customer customer = new Customer();
		customer.setCreationTime(rs.getTimestamp("creation_time"));
		customer.setCustomerId(rs.getInt("customer_id"));
		customer.setCustomerName(rs.getString("customer_name"));
		customer.setHomeAddress(rs.getString("home_address"));
		customer.setHomePhone(rs.getString("home_phone"));
		customer.setNewestAddress(rs.getString("lastest_address"));
		customer.setLastUpdate(rs.getTimestamp("last_update"));
		customer.setNewestPhone(rs.getString("newest_phone"));
		customer.setOfficeAddress(rs.getString("office_address"));
		customer.setOfficePhone(rs.getString("office_phone"));
		return customer;
	}

}
